package com.allen.imsystem.chat.model.pojo;

import com.allen.imsystem.common.Const.GlobalConst;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "Group对象", description = "")
@TableName("`group`")
public class Group implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "群id")
    @TableId(value = "gid", type = IdType.NONE)
    private String gid;

    @ApiModelProperty(value = "群名")
    private String groupName;

    @ApiModelProperty(value = "群主uid")
    private String ownerId;

    @ApiModelProperty(value = "最后一条消息的id")
    private Long lastMsgId;

    @ApiModelProperty(value = "最后一条消息的内容")
    private String lastMsgContent;

    @ApiModelProperty(value = "最后一条信息发送者的uid")
    private String lastSenderId;

    @ApiModelProperty(value = "最后一条消息的发送时间")
    private Date lastMsgCreateTime;

    @ApiModelProperty(value = "群头像")
    private String avatar;

    @ApiModelProperty(value = "0->已解散，1->有效")
    @TableField("`status`")
    private Boolean status;

    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    private Date createdTime;

    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    public Group() {
    }


    public Group(String gid, String groupName, String ownerId) {
        this.gid = gid;
        this.groupName = groupName;
        this.ownerId = ownerId;
    }

//    public void setAvatar(String avatar) {
//        this.avatar = GlobalConst.Path.AVATAR_URL + avatar;
//    }
}
